import 'package:flutter/material.dart';
import '../utils/general.dart';

class FFGuess extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return FFGuessState();
  }

}

class FFGuessState extends State<FFGuess> {
  double scale ;
  @override
  Widget build(BuildContext context) {
    scale = widthScale(context);
    return Padding(
      padding: EdgeInsets.fromLTRB(15 * scale, 15 * scale, 15 * scale, 0),
      child:Column(
        children: <Widget>[
          Padding(
            padding: EdgeInsets.symmetric(vertical:15 * scale),
            child: Row(
              mainAxisAlignment:MainAxisAlignment.spaceBetween,
              children:[
                Text(
                  '猜你喜欢',
                  style:TextStyle(color:Colors.black87, fontSize:15 * scale),                  
                ),
                GestureDetector(
                  onTap:(){
                    showMessage(context, '点击切换');
                  },
                  child:Row(
                    mainAxisSize: MainAxisSize.min,
                    children: <Widget>[
                      Icon(Icons.rotate_right, size:20 * scale, color:Color.fromRGBO(148, 190, 236, 1.0)),
                      Text('换一批', style:TextStyle(fontSize: 11 * scale, fontWeight:FontWeight.normal, color:Color.fromRGBO(148, 190, 236, 1.0), decoration: TextDecoration.none)),
                    ],)
                )

              ]
            ),
          ),
          SizedBox(
            width:screenWidth(context),
            height:180 * scale,
            child: GridView.builder(
              gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
                maxCrossAxisExtent: 108 * scale,
                mainAxisSpacing:0,
                crossAxisSpacing:10 * scale,
                childAspectRatio:108 / 180,
              ), 
              itemBuilder: (BuildContext context, int index){
                return PhysicalModel(
                  borderRadius:BorderRadius.circular(10.0),
                  clipBehavior:Clip.antiAlias,
                  color: Colors.white,
                  child: Column(
                    mainAxisAlignment:MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Column(
                        mainAxisSize: MainAxisSize.min,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Image.asset('assets/images/menu/goods${index + 1}.png', width:108 * scale, height: 108 * scale, fit:BoxFit.fill),
                          Text(' 金枪鱼谷物沙拉', style:TextStyle(fontSize:11 * scale, color:Colors.black87)),
                          Text(' Tuna and Mixed Grfla middelware soft project ', overflow: TextOverflow.ellipsis, maxLines: 1, style:TextStyle(fontSize:10 * scale, color:Colors.black38)),
                        ],
                      ),
                      Padding(
                        padding: EdgeInsets.fromLTRB(5 * scale, 10 * scale, 5 * scale, 10 * scale),
                        child: Text(' ¥25.08', style:TextStyle(fontSize:12 * scale, color:Colors.black45)),
                      )                      
                    ],

                  ),
                );
              }, 
              itemCount: 3,
            )
          ),
        ],
      )
    );
  }

}